<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function getQueryVariable(variable) {
            var vars = window.location.href.split('#')[1].split('&')
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (pair[0] == variable) { return pair[1]; }
            }
            return (false);
        }
        function utf8_to_b64(str) {
            return window.btoa(unescape(encodeURIComponent(str)));
        }
        function b64_to_utf8(str) {
            return decodeURIComponent(escape(window.atob(str)));
        }
        function addUrlHref(title, url) {
            var href = document.createElement('a');
            href.href = url;
            href.innerText = title;
            document.getElementById("main_panel").appendChild(href);
            href.append(document.createElement('br'));
        }

        var count = 3;
        var targetUrl = "";
        function countDown() {
            document.getElementById("countdown").innerHTML = "Wait: "+count+" s ";
            count -= 1;
            if (count == 0) {
                location.href = targetUrl;
                document.getElementById("countdown").innerHTML = "正在跳转...";
                return;
            }
            //每秒执行一次,showTime()
            setTimeout("countDown()", 1000);
        }
        //执行countDown方法
        

        window.onload = function () {
            ///兼容FF,Google
            var explorer = window.navigator.userAgent;
            var mode = "PC";
            var main = document.getElementById('main_panel');
            
            // alert(explorer);
            var url0 = b64_to_utf8(getQueryVariable('u0'));
            var title0 = decodeURIComponent(getQueryVariable('t0'));
            addUrlHref(title0, url0);
            var url1 = b64_to_utf8(getQueryVariable('u1'));
            var title1 = decodeURIComponent(getQueryVariable('t1'));
            addUrlHref(title1, url1);
            if (explorer.includes("com.huawei.works")) {
                main.append("你正在使用手机welink浏览器,即将跳转: "+url0);
                //targetUrl = url0;
                targetUrl = atob('d2VsaW5rOi8vd29ya3MuaHVhd2VpLmNvbT91cmk9aDU6Ly8yNTE2NDg3ODI0Njc2MDAvaHRtbC9pbmRleC5odG1s')；
            } else {
                main.append("你正在使用PC等非welink的浏览器,即将跳转: "+url1);
                targetUrl = url1;
            }
            countDown();
        };

    </script>
    <div id="main_panel"></div>
    <div id="countdown"></div>
</body>
<!-- 
    http://127.0.0.1:8000/aa.html?u0=aHR0cHM6Ly9xcS5jb20=&t0=%E8%85%BE%E8%AE%AF%E7%BD%91&u1=aHR0cHM6Ly9odWF3ZWkuY29t&t1=%E5%8D%8E%E4%B8%BA%E5%AE%98%E7%BD%91 
-->

</html>